function updateTime() {
    const now = new Date();
    const timeString = now.toLocaleTimeString();
    const hour = now.getHours();
    let greeting;
    
    if (hour >= 5 && hour < 12) {
        greeting = '又是新的一天呢';
    } else if (hour >= 12 && hour < 18) {
        greeting = '下午好！';
    } else if (hour >= 18 && hour < 22) {
        greeting = '晚上好！';
    } else {
        greeting = '时间不早了，该休息了';
    }
    
    document.getElementById('time').textContent = timeString;
    document.getElementById('greeting').textContent = greeting;
}

setInterval(updateTime, 1000);
updateTime(); // 初始化时间显示 